﻿using System.Collections;
using System.Collections.Generic;
using System;
namespace AutoChess
{
    public class ActionObject 
    {
        //行动延时
        private float delayTime = 0;
        //行动逻辑体
        private Action action;
        //优先级
        private int priority = 1;

        private bool isFinished = false;
        public virtual bool IsFinished
        {
            get { return isFinished; }
        }
        public int Priority
        {
            get { return priority; }
        }

        public void InitAction(Action action,float delayTime,int priority,object param = null)
        {
            this.priority = priority;
            this.action = action;
            this.delayTime = delayTime;
        }
        public virtual void Tick(float deltaTime)
        {
            delayTime -= deltaTime ;
            if (delayTime <= 0)
            {
                if (action != null)
                {
                    action();
                }
                isFinished = true;
            }
        }
    }
}